var fs = require('fs')

// json文件目录
var notionFilePath = './statistic/01_communciation/notion.json'
var personFilePath = './statistic/01_communciation/person.json'
var situationFilePath = './statistic/01_communciation/situation.json'
var qaFilePath = './statistic/01_communciation/qa.json'
var pointFilePath = './statistic/01_communciation/point.json'
var processFilePath = './statistic/01_communciation/process.json'
var drFilePath = './statistic/01_communciation/detail_record.json'
var da1FilePath = './statistic/01_communciation/detail_analyze_1.json'
var da2FilePath = './statistic/01_communciation/detail_analyze_2.json'
var da3FilePath = './statistic/01_communciation/detail_analyze_3.json'


const loadData = function(url) {
    var temp = fs.readFileSync(url, 'utf8')
    var temps = JSON.parse(temp)
    return temps
}


// // notion部分
var notions = {
    data:loadData(notionFilePath)
}
// person部分
var persons = {
    data:loadData(personFilePath)
}
// situation部分
var situations = {
    data:loadData(situationFilePath)
}
// // qa部分
var qas = {
    data:loadData(qaFilePath)
}
// // point部分
var points = {
    data:loadData(pointFilePath)
}
// // process部分
var processs = {
    data:loadData(processFilePath)
}
// // detail_record
var dr = {
    data:loadData(drFilePath)
}
// // detail_analyze_1
var da1 = {
    data:loadData(da1FilePath)
}
// // detail_analyze_2
var da2 = {
    data:loadData(da2FilePath)
}
// // detail_analyze_3
var da3 = {
    data:loadData(da3FilePath)
}





// 模块导出
// 定义相关函数

var res = {}


res.notionAll = function() {
    var contents = notions.data
    return contents
}
res.personAll = function() {
    var contents = persons.data
    return contents
}
res.situationAll = function() {
    var contents = situations.data
    return contents
}
res.qaAll = function() {
    var contents = qas.data
    return contents
}
res.pointAll = function() {
    var contents = points.data
    return contents
}
res.processAll = function() {
    var contents = processs.data
    return contents
}
res.drAll = function() {
    var contents = dr.data
    return contents
}
res.da1All = function() {
    var contents = da1.data
    return contents
}
res.da2All = function() {
    var contents = da2.data
    return contents
}
res.da3All = function() {
    var contents = da3.data
    return contents
}






//导出一个对象，可直接引用
module.exports = res
